package com.yowasa.xiuxian.engine.travel.adventure;

import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.yowasa.xiuxian.engine.travel.AdventureInterface;
import com.yowasa.xiuxian.entity.bo.user.UserBO;
import com.yowasa.xiuxian.entity.enums.MapEnum;
import com.yowasa.xiuxian.entity.enums.RefreshType;
import com.yowasa.xiuxian.service.helper.ItemHelper;
import com.yowasa.xiuxian.service.helper.ResourceHelper;
import com.yowasa.xiuxian.util.RandomUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Set;

/**
 * 金陵大厨 一次刷新仅能被触发一次
 * 上架一个鲜香锅巴
 */
@Component
public class QianYanTongXinTUADV implements AdventureInterface {


    @Autowired
    private ResourceHelper resourceHelper;
    @Autowired
    private ItemHelper itemHelper;

    @Override
    public Set<MapEnum> limitMaps() {
        //程曦
        return Sets.newHashSet(MapEnum.JUE_YUN_JIAN);
    }

    public boolean limitCheck(UserBO user) {
        return resourceHelper.checkHaveResource(user.getGuildId(), this.getClass().getName(), RefreshType.LOCK_TIME);
    }

    @Override
    public String exec(UserBO user) {
        resourceHelper.lockResource(user.getGuildId(), this.getClass().getName(), 10 * 360);
        itemHelper.addItem(user, "千岩同心图纸", 1);
        String choice = RandomUtil.choice(Lists.newArrayList("削月筑阳", "理水叠山", "留云借风", "移霄导天", "鸣海栖霞"));
        String msg = "你在秘境中经历了一场恶战，慌乱中误入了一处仙人洞府，\n你仔细辨认，认出这是"+choice+"真君的洞府，\n你在洞府暂时休养，没想到唤醒了真君留下的残念，你向真君说明来意，\n真君听后说:“本仙看你资质不错，愿帮你，你可愿接受我的试炼？”\n你忙点头。在几天的试炼后真君给了你一张图纸说:“此物可保护你免受怪物的伤害 \n" +
                "\n你获得了装备[千岩同心]的锻造图纸";
        return msg;
    }


    public boolean isConflict() {
        return true;
    }
    public int weight() {
        return 1;
    }

}
